﻿using Server.Constant;
using Server.Framework.Message;
using Server.Model;
using System.Collections.Generic;

namespace Server.Message.Request
{
    /// <summary>
    /// Author: Leil
    /// Description: 新增或编辑请求消息
    /// CreateTime: 2020/5/13 10:07:46
    /// </summary>
    [MessageAttr(MessageId.ADD_EDIT_MENU)]
    class AddEditMenuReq : RequestBaseMessage
    {
        public MenuDao Menu { get; private set; }

        public override void Deserialize(byte[] buffer)
        {
            AddEditMenu msg = AddEditMenu.Parser.ParseFrom(buffer);
            if (msg.Menu != null)
            {
                Menu = new MenuDao
                {
                    ID = msg.Menu.Id,
                    ParentId = msg.Menu.ParentId,
                    Icon = msg.Menu.Icon,
                    ScreenCode = msg.Menu.ScreenCode,
                    MenuName = msg.Menu.MenuName,
                    MenuType = msg.Menu.MenuType,
                    Status = msg.Menu.Status,
                    Sort = msg.Menu.Sort,
                };
            }
        }
    }
}
